package com.noble.meether.db.init;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.noble.meether.chat.ui.system.store.NoticeTable;
import com.noble.meether.db.type.msg.MsgTable;
import com.noble.meether.fragment.mail.store.MsgListTable;

/**
 * 数据库初始化创建
 */
public class DBHelper extends SQLiteOpenHelper {

    private static final int VERSION = 1;

    public DBHelper(Context context, String DBNAME) {
        super(context, DBNAME + ".db", null, VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        // 执行CRUD有更改行为的SQL语句
        db.execSQL(MsgTable.getCreateTable());      // 聊天消息
        db.execSQL(NoticeTable.getCreateTable());   // 公告消息
        db.execSQL(MsgListTable.getCreateTable());  // 聊天列表
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }
}
